import {
        request
} from '../request/request.js'

// 首页轮播图
export function getHomeSwiperData() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/banner/list',
                        method: 'GET',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 首页导航
export function getNavigation() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/category/all',
                        method: 'GET',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 限时秒杀
export function getSecond() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/list?miaosha=' + true,
                        method: 'POST',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 爆品推荐
export function getproducts() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/list',
                        method: 'POST',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 商品列表
export function getproduct() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/list',
                        method: 'POST',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 疯狂砍价
export function getbargaining() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/list?kanjia=' + true,
                        method: 'POST',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 全民拼团
export function getwork() {
        return new Promise((resolve, resject) => {
                request({
                        url: '/shop/goods/list?pingtuan=' + true,
                        method: 'POST',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 商品详情
export function getdetails(id) {
        return new Promise((resolve, resject) => {
                request({
                        url: `/shop/goods/detail?id=${id}`,
                        method: 'GET',
                }).then(res => {
                        resolve(res)
                })
        })
}